﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.BLL;
using Grove.ORM;
using HZ.MBSM.Model;
using HZ.MBSM.DBUtility;
using System.Drawing;
public partial class Bidder_BidGoodsManage : System.Web.UI.Page
{

    private const int GridColumnIndexOfGoodsId = 0;
    private const int GridColumnIndexOfProductCode = 1;
    private const int GridColumnIndexOfProductName = 2;
    private const int GridColumnIndexOfMemo3 = 3;
    private const int GridColumnIndexOfMemo1 = 4;
    private const int GridColumnIndexOfGoodsName = 5;
    private const int GridColumnIndexOfMedicinemodel = 6;
    private const int GridColumnIndexOfOutlookc = 7;
    private const int GridColumnIndexOffactor = 8;
    private const int GridColumnIndexOfUnit = 9;    
    private const int GridColumnIndexOfCompanyNameSC = 10;
    private const int GridColumnIndexOfUserCodeSC = 11;
    private const int GridColumnIndexOfRetailPrice = 12;
    private const int GridColumnIndexOfQualityLevels = 13;
    private const int GridColumnIndexOfIsImport = 14;
    private const int GridColumnIndexOfCheckstatus1 = 15;
    private const int GridColumnIndexOfDel = 16;
    private const int GridColumnIndexOfBidId = 17;
    private const int GridColumnIndexOfCheckstatus2 = 18;
    private const int GridColumnIndexOfCompanyName_PS1 = 19;
    private const int GridColumnIndexOfCompanyName_PS2 = 20;
    private const int GridColumnIndexOfAccountId_PS = 21;
    private const int GridColumnIndexOfq = 22;
    private const int GridColumnIndexOfLink = 23;
    private const int GridColumnIndexOfBiddingSwitching = 24;
    private const int GridColumnIndexOfMEMO9 = 25;



    string companyname,productname,outlookc,medincine,AccountId_Sort;
    Int32 prjid;
    Int64 AccountId_TBR;
    public String status;
    string Goodsid, BGMstrConditions, _strTable;

    protected void Page_Load(object sender, EventArgs e)
    {
        
        prjid = SysFun.ToInt( Request.QueryString["ProjectId"]);
        string bidid, strSql;

       
        System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> _AccountType = new System.Collections.Generic.List<HZ.MBSM.DAL.AccountType>();
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumCompany);
        if (HZ.MBSM.BLL.Login.CheckAssert(_AccountType))
        {
            HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)Session["Account"];

            if (_Account != null)
            {

                if (!IsPostBack)
                {
                    lstCheckStatus.Items.Add("全部");
                    lstCheckStatus.Items.Add("未审核");
                    lstCheckStatus.Items.Add("审核通过");
                    lstCheckStatus.Items.Add("审核未通过");
                }
                AccountId_TBR = SysFun.ToLong(_Account.AccountId);
                AccountId_Sort = _Account.Sort;
                if (AccountId_Sort == "0")
                {
                    status = "block";
                }
                else
                {
                    status = "none";
                    this.Label5.Visible = false;
                }
                
                if (Request.Form["SaveId"] == "保存所选配送企业")
                {
                    string s = "";
                    foreach (GridViewRow row in GridView2.Rows)
                    {
                        if (row.RowType == DataControlRowType.DataRow)
                        {
                            string AccountidPS = Request.Form["textmark" + row.Cells[GridColumnIndexOfBidId].Text];
                            s += "@" + "update Project_bid Set memo7=" + AccountidPS + " Where BidId=" + row.Cells[GridColumnIndexOfBidId].Text;
                        }
                    }
                    Db db = new Db();
                    if (s.Length > 0)
                    {
                        db.ExecuteTransaction(s.Substring(1).Split(new char[] { '@' }), 30);
                    }
                    db.Close();
                    // HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)Session["Account"];
                    HZ.MBSM.BLL.LogManage.RecordLoginDetail(_Account.AccountName, Request.UserHostAddress, "更新", "Project_bid", s, "../Bidder/BidGoodsManage.aspx");

                }
                //string aa = Request.Form["aaa"];
                if (Request.Form["btnSubmit"] == "删除" && Request.Form["chk_"] != null)
                {
                    bidid =Request.Form["chk_"].ToString();
                    bidid = bidid.Replace(",", "','");
                    Db db = new Db();
                    strSql = "@"+ "delete from project_bid where goodsid in ('" + bidid + "') and checkstatus=0";
                    strSql += "@" + "update bid_goods_tbr set status =2 where goodsid in ('" + bidid + "')  ";
                    db.ExecuteTransaction(strSql.Substring(1).Split(new char[] { '@' }), 30);
                    db.Close();
                    HZ.MBSM.BLL.LogManage.RecordLoginDetail(_Account.AccountName, Request.UserHostAddress, "删除", "project_bid", strSql, "../Bidder/BidGoodsManage.aspx");

                }
               
                showGridView();
                if (Request.Form["subPrint"] == "投标药品一览表")
                {
                    PrintKB();
                }
                if (Request.Form["subPrintCompany"] == "投标人所投厂家一览表")
                {
                    Db db = new Db();
                    System.Data.IDataReader dr;
                    strSql = "select distinct company.usercode,company.companyname from company inner join goods on company.accountid=goods.AccountId_sc inner join project_bid on project_bid.goodsid=goods.goodsid where project_bid.projectid=" + prjid.ToString() + " and project_bid.accountid= " + _Account.AccountId.ToString() + " order by company.usercode";
                    dr = db.DataReader(strSql);
                    GridView3.DataSource = dr;
                    GridView3.DataBind();
                    dr.Close();
                    db.Close();
                    PrintKBCompany();
                }
                
             
            }
        }

    }

    public void showGridView()
    {
        BGMstrConditions = fctConditions();
        _strTable = fctTable();
        Db db = new Db();
        DbPage dbPage = new DbPage(db);
        dbPage.Table = _strTable;                                               //要查询的表明
        dbPage.Key = "Bidid";                                               //表的主键    
        dbPage.Where = BGMstrConditions;                                           //查询条件    

        dbPage.SelectField = "Product.Productid,Product.ProductCode,dbo.Product.ProductName,dbo.Product.Outlookc,dbo.Product.Medicinemodel,Product.Memo3,Product.Memo1,Product.Unit,dbo.Goods.Factor, dbo.Company.CompanyName, dbo.Project_Bid.GoodsId,dbo.Project_Bid.BidId, Goods.GoodsName,goods.RetailPrice, dbo.Project_Bid.CheckStatus,CompanyPS.CompanyName AS PSName,dbo.Project_Bid.MEMO7 AS PSAccountid,Company.Usercode,PriceSwitching,BiddingSwitching,case Goods.IsImport when 1 then '是' else '否' end as IsImport, CASE Goods.QualityLevels " + ConfigurationManager.AppSettings["QualityLevels"].ToString() + " END AS QualityLevels,Project_Bid.MEMO10";//要显示的字段
        dbPage.PageIndex = SysFun.ToInt(Request["CurrentlyPageIndex"]);          //要显示第几页   
        if (Request.Form["subPrint"] == "投标药品一览表")
        {
            dbPage.PageSize = 1;                                                    //没有显示记录条数   
        }
        else
        {
            dbPage.PageSize = 20;                                                    //没有显示记录条数   
        }
        dbPage.OrderBy = "dbo.Company.CompanyName,Bidid";                  //排序字段
        System.Data.IDataReader dr = dbPage.ExecuteReader();
        GridView2.DataSource = dr;
        GridView2.DataBind();
        dr.Close();
        dr.Dispose();
        dbPage.Db.Close();
        db.Close();
        this.DbPageFlip1.DbPage = dbPage;//将数据传给控键

    }

    public string fctTable()
    {
        String Table;
        Table = @"dbo.Project_Bid INNER JOIN dbo.Goods ON dbo.Project_Bid.GoodsId = dbo.Goods.GoodsId INNER JOIN
                  dbo.Product ON dbo.Goods.ProductId = dbo.Product.ProductId INNER JOIN
                  dbo.Company ON 
                  dbo.Goods.AccountId_SC = dbo.Company.AccountId LEFT OUTER JOIN
                  dbo.ProjectCompanyAttribution ON 
                  dbo.Project_Bid.AccountId = dbo.ProjectCompanyAttribution.AccountId AND 
                  dbo.Project_Bid.ProjectId = dbo.ProjectCompanyAttribution.ProjectId LEFT OUTER JOIN
                  dbo.Company CompanyPS ON dbo.Project_Bid.MEMO7 = CompanyPS.AccountId ";
        return Table;
    }

    public string fctConditions()
    {
        productname = txtname.Text.Trim();
        outlookc = txtoutlook.Text.Trim();
        medincine = txtmedicinemodel.Text.Trim();
        companyname = txtcompany.Text.Trim();
        Goodsid = txtGoodsId.Text.Trim();
        string _strWhere = "";

        _strWhere = " project_bid.projectid= " + prjid.ToString() + " And Project_Bid.accountid ='" + AccountId_TBR.ToString() + "' And";
        if (productname != "")
        {
            _strWhere += " product.productname like '%" + productname + "%' And";

        }
        if (outlookc != "")
        {
            _strWhere += " product.outlookc like '%" + outlookc + "%' And";
        }
        if (medincine != "")
        {
            _strWhere += " product.medicinemodel like '%" + medincine + "%' And";
        }
        if (companyname != "")
        {
            _strWhere += " Company.companyname like '%" + companyname + "%' And";
        }
        if (Goodsid != "")
        {
            _strWhere += " Project_Bid.GoodsId ='" + Goodsid + "' And";
        }

        //汪东亮  是否缺资料

        string isQzl = qzl.SelectedValue.Trim();
        if (isQzl != "2")
        {
            if (isQzl == "0")
            {
                _strWhere += " isnull(Project_Bid.memo10,'') <>'' And";
            }
            else
            {
                _strWhere += " isnull(Project_Bid.memo10,'') ='' And";
            }
        }

        //生产企业注册号

        string _strUserCode_SC = txtUserCode_SC.Text;
        if (_strUserCode_SC != "")
        {
            _strWhere += " Company.UserCode like '%" + _strUserCode_SC + "%' And";
        }
        //审核状态

        string _strCheckStatus = lstCheckStatus.SelectedValue;
        switch (_strCheckStatus)
        {
            case "全部":
                break;
            case "未审核":
                _strWhere += " (Project_Bid.CheckStatus=0 or Project_Bid.CheckStatus is null)  And";
                break;
            case "审核通过":
                _strWhere += " Project_Bid.CheckStatus=1 And";
                break;
            case "审核未通过":
                _strWhere += " Project_Bid.CheckStatus=2 And";
                break;
        }
        if (_strWhere != "")
        {
            _strWhere = "  " + _strWhere.Substring(0, _strWhere.Length - 3);
        }
        return _strWhere;
    }
    
    
       
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
            e.Row.Cells[GridColumnIndexOfBidId].Visible = false;//bidid
            e.Row.Cells[GridColumnIndexOfCheckstatus2].Visible = false;//checkstatus
            e.Row.Cells[GridColumnIndexOfCompanyName_PS2].Visible = false;//隐藏的配送企业

            e.Row.Cells[GridColumnIndexOfAccountId_PS].Visible = false;//隐藏的配送企业号
            if (AccountId_Sort == "1")
            {
                e.Row.Cells[GridColumnIndexOfLink].Visible = false;//选择主要配送企业

                e.Row.Cells[GridColumnIndexOfCompanyName_PS1].Visible = false;//主要配送企业

            }
            e.Row.Cells[GridColumnIndexOfBiddingSwitching].Visible = false;//投标开关


        
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if ((e.Row.Cells[GridColumnIndexOfCheckstatus2].Text == "0") && (e.Row.Cells[GridColumnIndexOfBiddingSwitching].Text == "1"))
                {
                    //cell[GridColumnIndexOfDel]bidid
                    //e.Row.Cells[GridColumnIndexOfDel].Text = "<input type=checkbox id=\"chk_" + e.Row.Cells[GridColumnIndexOfBidId].Text + "\" name=\"chk_\" value=\"" + e.Row.Cells[GridColumnIndexOfBidId].Text + "\" />";

                    e.Row.Cells[GridColumnIndexOfDel].Text = "<input type=checkbox id=\"chk_" + e.Row.Cells[GridColumnIndexOfBidId].Text + "\" name=\"chk_\" value=\"" + e.Row.Cells[GridColumnIndexOfGoodsId].Text + "\" />";


                }
                else
                {
                    //cell[GridColumnIndexOfCheckstatus1]删除框

                    //e.Row.Cells[GridColumnIndexOfDel].Text = "<input type=checkbox id=\"chk_" + e.Row.Cells[GridColumnIndexOfDel].Text + "\" name=\"chk_\" value=\"" + e.Row.Cells[GridColumnIndexOfAccountId_PS].Text + "\" disabled/>";
                    e.Row.Cells[GridColumnIndexOfDel].Text = "";
                    if (e.Row.Cells[GridColumnIndexOfCheckstatus2].Text == "1")
                    {
                        e.Row.Cells[GridColumnIndexOfCheckstatus1].Text = "审核已通过";
                    }
                    else
                    {
                        if (AccountId_Sort == "0")
                        {
                            e.Row.Cells[GridColumnIndexOfCheckstatus1].Text = "<a target=\"_blank\" href=\"GoodDetail.aspx?GoodsId=" + e.Row.Cells[GridColumnIndexOfGoodsId].Text + "\">审核不通过</a>";
                        }
                        else
                        {
                            e.Row.Cells[GridColumnIndexOfCheckstatus1].Text = "审核不通过";
                        }
                    }
                }
                if (e.Row.Cells[GridColumnIndexOfCheckstatus2].Text == "0")
                {
                    e.Row.Cells[GridColumnIndexOfCheckstatus1].Text = "未审核";
                }

                //Cells[GridColumnIndexOfCheckstatus2]主要配送企业,Cells[GridColumnIndexOfAccountId_PS]ShowHeader="False"
                if (Request.Form["subPrint"] == "投标药品一览表")
                {
                    e.Row.Cells[GridColumnIndexOfCompanyName_PS1].Text = SysFun.MoveSpace(e.Row.Cells[GridColumnIndexOfCompanyName_PS2].Text);//value值为隐藏的配送企业

                }
                else
                {
                    e.Row.Cells[GridColumnIndexOfCompanyName_PS1].Text = "<input type=text style=\"width: 60\" name=\"text" + e.Row.Cells[GridColumnIndexOfBidId].Text + "\" value=\"" + SysFun.MoveSpace(e.Row.Cells[GridColumnIndexOfCompanyName_PS2].Text) + "\" readonly/>" + "<input type=hidden name=\"textmark" + e.Row.Cells[GridColumnIndexOfBidId].Text + "\" value=\"" + SysFun.ToInt(e.Row.Cells[GridColumnIndexOfAccountId_PS].Text) + "\" readonly/>";//value值为隐藏的配送企业

                }

            }
            if (e.Row.Cells[GridColumnIndexOfCheckstatus2].Text == "2")
            {
                e.Row.BackColor = Color.Yellow;

            }
            if (Request.Form["subPrint"] == "投标药品一览表")
            {
                e.Row.Cells[GridColumnIndexOfDel].Visible = false;                                                   //没有显示记录条数   
                e.Row.Cells[GridColumnIndexOfLink].Visible = false;
                e.Row.Cells[GridColumnIndexOfCheckstatus1].Visible = false;
                e.Row.Cells[GridColumnIndexOfMEMO9].Visible = false;
                e.Row.Cells[GridColumnIndexOfCompanyName_PS1].Visible = false;
                //e.Row.Cells[GridColumnIndexOfMemo3].Visible = true;
                //e.Row.Cells[GridColumnIndexOfMemo1].Visible = true;
                //e.Row.Cells[GridColumnIndexOfRetailPrice].Visible = true;
                //e.Row.Cells[GridColumnIndexOfIsImport].Visible = true;

            }
            //else
            //{
            //    e.Row.Cells[GridColumnIndexOfMemo3].Visible = false;
            //    e.Row.Cells[GridColumnIndexOfMemo1].Visible = false;
            //    e.Row.Cells[GridColumnIndexOfRetailPrice].Visible = false;
            //    e.Row.Cells[GridColumnIndexOfIsImport].Visible = false;

            //}

            e.Row.Cells[GridColumnIndexOfq].Visible = false;
    }

    protected void PrintKB()
    {

        Response.Clear();
        Response.Buffer = true;
        Response.Charset = "GB2312";
        // 添加头信息，为"文件下载/另存为"对话框指定默认文件名 
        Response.AddHeader("Content-Disposition", "attachment; filename=11.xls");
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
        Response.ContentEncoding = System.Text.Encoding.UTF7;  //解决将gridview导出成excel时出现乱码  
        Response.ContentType = "application/ms-excel";
        this.EnableViewState = false;
        System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
        this.GridView2.RenderControl(oHtmlTextWriter);

        //// 把文件流发送到客户端 
        //Response.Write(oStringWriter.ToString());
        //// 停止页面的执行


        //Response.End();
        HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)Session["Account"];
        if (oStringWriter.ToString().Length > 257)
        {
            System.Text.StringBuilder strHtml = new System.Text.StringBuilder();
            strHtml.Append("<p align=center style='text-align:center'><b><span style='font-size:18.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family: \"Times New Roman\";mso-hansi-font-family:\"Times New Roman\"'>投标药品一览表</span></b><b><span lang=EN-US style='font-size:18.0pt;mso-bidi-font-size:12.0pt'><o:p></o:p></span></b></p>");
            strHtml.Append("<p><span style='font-size:10.0pt;font-family:宋体;mso-ascii-font-family: \"Times New Roman\";mso-hansi-font-family:\"Times New Roman\"'><strong>投标人名称：" + _Account.DWName + "（" + _Account.UserCode + "）</strong></span></p> ");

            strHtml.Append(oStringWriter.ToString().Substring(0, 258));
            //strHtml.Append("<tr  class=\"table_title\"><td colspan='10'align=\"center\"><strong><span style=\"font-size: 24pt\">投标药品一览表</span></strong></td></tr>");
            //strHtml.Append("<tr  class=\"table_title\"><td colspan='10' align='left'><strong>投标人名称：" + _Account.DWName + "（" + _Account.UserCode + "）</strong></td></tr>");
            strHtml.Append(oStringWriter.ToString().Substring(259, oStringWriter.ToString().Length - 278));
            strHtml.Append(oStringWriter.ToString().Substring(oStringWriter.ToString().Length - 19, 19));
            Db db = new Db();
            System.Data.IDataReader dr;
            string strSql = "select count( distinct company.usercode) as CompanyCount,count(project_bid.bidid) as RowsCount from company inner join goods on company.accountid=goods.AccountId_sc inner join project_bid on project_bid.goodsid=goods.goodsid where project_bid.projectid=" + prjid.ToString() + " and project_bid.accountid= " + _Account.AccountId.ToString();
            dr = db.DataReader(strSql);
            int _intCompanyCount = 0, _intRowCount = 0;
            if (dr.Read())
            {
                _intCompanyCount = SysFun.ToInt(dr["CompanyCount"].ToString());
                _intRowCount = SysFun.ToInt(dr["RowsCount"].ToString());
            }
            dr.Close();
            dr.Dispose();
            db.Close();
            strHtml.Append("<p class=MsoNormal align=right style='text-align:right'><span style='font-family: 宋体;mso-ascii-font-family:\"Times New Roman\";mso-hansi-font-family:\"Times New Roman\"'>共有 " + _intRowCount.ToString() + " 条记录</span></p> ");
            strHtml.Append("<p class=MsoNormal align=right style='text-align:right'><span style='font-family: 宋体;mso-ascii-font-family:\"Times New Roman\";mso-hansi-font-family:\"Times New Roman\"'>共有 " + _intCompanyCount.ToString() + " 个生产企业</span></p> ");
            strHtml.Append("<p class=MsoNormal align=center style='text-align:center'><span style='font-family:宋体;mso-ascii-font-family:\"Times New Roman\";mso-hansi-font-family: \"Times New Roman\"'>　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　投标人代表：</span></p>  ");
           
            
            // 把文件流发送到客户端 
            Response.Write(strHtml.ToString());
            // 停止页面的执行

            //strHtml.Append("<p><span style='font-size:12.0pt;font-family:宋体;mso-ascii-font-family: \"Times New Roman\";mso-hansi-font-family:\"Times New Roman\"'>投标药品一览表</span><span lang=EN-US style='font-size:12.0pt'><o:p></o:p></span></p>");
            //strHtml.Append("<p align=center style='text-align:center'><b><span style='font-size:18.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family: \"Times New Roman\";mso-hansi-font-family:\"Times New Roman\"'>投标药品一览表</span></b><b><span lang=EN-US style='font-size:18.0pt;mso-bidi-font-size:12.0pt'><o:p></o:p></span></b></p>");
            //strHtml.Append("<p><span style='font-size:12.0pt;font-family:宋体;mso-ascii-font-family: \"Times New Roman\";mso-hansi-font-family:\"Times New Roman\"'>投标人：<u>开封制药（集团）有限公司</u>　　　　　　企业类别：<u>生产企业</u>　　　　　　打印时间：</span><u><span lang=EN-US style='font-size:12.0pt'>2007-9-19</span></u><u><span style='font-size:12.0pt;font-family:宋体;mso-ascii-font-family:\"Times New Roman\"; mso-hansi-font-family:\"Times New Roman\"'>　</span></u><u><span lang=EN-US style='font-size:12.0pt'>15:1<o:p></o:p></span></u></p> ");
            //strHtml.Append(oStringWriter.ToString());

            //// 把文件流发送到客户端 
            //Response.Write(strHtml.ToString());

        }
        Response.End();

    }
    protected void PrintKBCompany()
    {

        Response.Clear();
        Response.Buffer = true;
        Response.Charset = "GB2312";
        // 添加头信息，为"文件下载/另存为"对话框指定默认文件名 
        Response.AddHeader("Content-Disposition", "attachment; filename=11.xls");
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
        Response.ContentEncoding = System.Text.Encoding.UTF7;  //解决将gridview导出成excel时出现乱码  
        Response.ContentType = "application/ms-excel";
        this.EnableViewState = false;
        System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
        this.GridView3.RenderControl(oHtmlTextWriter);

        //// 把文件流发送到客户端 
        //Response.Write(oStringWriter.ToString());
        //// 停止页面的执行


        //Response.End();

        HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)Session["Account"];
        System.Text.StringBuilder strHtml = new System.Text.StringBuilder();
        if (oStringWriter.ToString().Length > 257)
        {
            strHtml.Append(oStringWriter.ToString().Substring(0, 258));
            strHtml.Append("<tr  class=\"table_title\"><td colspan='3'align=\"center\"><strong><span style=\"font-size: 24pt\">投标人所投厂家一览表</span></strong></td></tr>");
            strHtml.Append(oStringWriter.ToString().Substring(259, oStringWriter.ToString().Length - 278));
            strHtml.Append("<tr  class=\"table_title\"><td colspan='1' align='right'><strong>投标人名称：</strong></td><td colspan='2'  ><strong>" + _Account.DWName + "（" + _Account.UserCode + "）</strong></td></tr>");
           
            // 把文件流发送到客户端 
            Response.Write(strHtml.ToString());
        }
        // 停止页面的执行

        Response.End();

    }
    public override void VerifyRenderingInServerForm(Control control)
    {
        //OverRide　为了使导出成Excel可行！

    }
    protected void GridView3_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Cells[0].Text = SysFun.ToTrim(e.Row.RowIndex+1);
        }
    }
}
